//
//  ITNewsCell.m
//  InTime
//
//  Created by zhangjia on 15/9/9.
//  Copyright (c) 2015年 ClownYoJoy. All rights reserved.
//

#import "ITNewsCell.h"
#import "NewsListModel.h"
#import "UIImageView+WebCache.h"

@implementation ITNewsCell

- (void)awakeFromNib {
    // Initialization code
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(NewsListModel *)model {
    _model = model;
    self.titleLabel.text = model.title;
    [self.coverImg sd_setImageWithURL:[NSURL URLWithString:model.imgsrc] placeholderImage:[UIImage imageNamed:@"for-check"]];
    self.subtitleLabel.text = model.digest;
    
    //如果图册有值.则是photoset类型
    if (model.imgextra) {
    [self.secondImg sd_setImageWithURL:[NSURL URLWithString:[model.imgextra[0] objectForKey:@"imgsrc"]] placeholderImage:[UIImage imageNamed:@"for-check"]];
   [self.thirdImg sd_setImageWithURL:[NSURL URLWithString:[model.imgextra[1] objectForKey:@"imgsrc"]] placeholderImage:[UIImage imageNamed:@"for-check"]];
    }
}


+ (NSString *)idForRow:(NewsListModel *)model {
    if (model.imgType) {
        return @"bigImgCell";
    }else if (model.skipType) {
        return @"photosetCell";
    }else {
        return @"CommonNewsCell";
    }
}


+ (CGFloat)heightForRow:(NewsListModel *)model {
    if (model.imgType) {
        return 195;
    }else if (model.skipType) {
        return 123;
    }else{
        return 90;
    }
}

@end
